;CookieTools=(function(){
	
	//name =value path domain expires=data secure
	return {
		setCookie:function(name,value,timer,path,domain,secure){
			//  name=value;expires=timer;path=xxx;domain=xxx;secure;
			var cookieStr=''
			if(name){
				cookieStr+=encodeURIComponent(name)+'='+encodeURIComponent(value)+";"
			}
			if(typeof(timer)=="number"){
				var date=new Date()
				date.setDate(date.getDate()+timer)
				cookieStr+="expires"+date.toUTCString()+";"
			}
			if(path){
				cookieStr+="path="+path+";"
			}
			if(domain){
				cookieStr+="domain="+domain+";"
			}
			if(secure){
				cookieStr+=secure;
			}
			return document.cookie=cookieStr
		},
		getCookieAll:function(){
			var obj={}
			var cookieStr=decodeURIComponent(document.cookie)
			var cookieArr=cookieStr.split(";")
			cookieArr.forEach((el)=>{
				var arr=el.split("=")
				obj[arr[0].trim()]=arr[1]
			})
			return obj
		},
		getCookieByName:function(name){
			return this.getCookieAll()[name]
		},
		removeCookie:function(name){
			this.setCookie(name,"",-1)
		}	
	}
})();